//
//  RNOLMyReferrerCell.m
//  RongNiuOnline
//
//  Created by apple on 2018/4/23.
//  Copyright © 2018年 rongniu. All rights reserved.
//

#import "RNOLMyReferrerCell.h"

@interface RNOLMyReferrerCell()

@property (nonatomic,strong) UILabel *referrerInfoLabel;
@property (nonatomic,strong) UILabel *tipLabel;
@property (nonatomic,strong) UIButton *modifyButton;
@property (nonatomic,strong) UIView *bottomLineView;
@end


@implementation RNOLMyReferrerCell

- (UILabel *)referrerInfoLabel{
    if (!_referrerInfoLabel) {
        _referrerInfoLabel = [RNOLUnitTool createLabelWithText:@"邀请人：13510751226   张**" textColor:kTextColor fontSize:15];
        [self.contentView addSubview: _referrerInfoLabel];
    }
    return _referrerInfoLabel;
}

- (UILabel *)tipLabel{
    if (!_tipLabel) {
        _tipLabel = [RNOLUnitTool createLabelWithText:@"(注册时忘记填写或填写错误推荐码)" textColor: kTextLightGrayColor fontSize:10];
        [self.contentView addSubview: _tipLabel];
    }
    return _tipLabel;
}


- (UIButton *)modifyButton{
    if (!_modifyButton) {
        _modifyButton = [UIButton buttonWithType: UIButtonTypeCustom];
        [_modifyButton setTitle:@"立即绑定/修改" forState:UIControlStateNormal];
        [_modifyButton setTitleColor: kAppMainColor forState: UIControlStateNormal];
        _modifyButton.titleLabel.font = KFontSize(10);
        ViewBorderRadius(_modifyButton, 2.0f, 1.0f, kAppMainColor);
        [_modifyButton addTarget:self action:@selector(modifyButtonClickAction:) forControlEvents:UIControlEventTouchUpInside];
        [self.contentView addSubview: _modifyButton];
    }
    return _modifyButton;
}


- (UIView *)bottomLineView{
    if (!_bottomLineView) {
        _bottomLineView = [RNOLUnitTool createViewWithBackgroundColor:kBgColor];
        [self.contentView addSubview: _bottomLineView];
    }
    return _bottomLineView;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self =[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.backgroundColor = KWhiteColor;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self setupLayout];
    }
    return self;
}

- (void)setupLayout{
    [self.modifyButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.equalTo(@22);
        make.width.equalTo(@80);
        make.right.equalTo(self.contentView.mas_right).with.offset(-22);
        make.centerY.equalTo(self.contentView.mas_centerY);
    }];
    
    [self.referrerInfoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@22);
        make.right.equalTo(self.modifyButton.mas_left).offset(-10);
        make.height.equalTo(@25);
        make.top.equalTo(@15);
    }];
    
    [self.tipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(self.referrerInfoLabel);
        make.top.equalTo(self.referrerInfoLabel.mas_bottom);
        make.height.equalTo(@21);
    }];
    
    [self.bottomLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.equalTo(@8);
        make.left.right.equalTo(self.contentView);
        make.bottom.equalTo(self.contentView.mas_bottom);
    }];
    
}


#pragma mark- 立即绑定/修改
- (void)modifyButtonClickAction:(UIButton *)button{
    
    
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
